(function(window, $){
	function Modal(){
		this.init();
	};
	Modal.prototype.init = function(){
		this.create_modal();
	};
	Modal.prototype.create_modal = function(){
		const html = `
		<div id="error-modal">
			<div class="error-content">
				<div class="error-title">
					提示信息
				</div>
				<div class="error-text">
					密码不正确!
				</div>
				<div class="error-footer">
					<button class="btn btn-left">
						关闭
					</button>
					<button class="btn btn-right">
						确认
					</button>
				</div>
			</div>
		</div>
		`;
		console.log(html);
		$("body").append(html);

		$("#error-modal .btn-left").click(()=>{
			this.onCancel();
		});
		$("#error-modal .btn-right").click(()=>{
			this.onOk();
		});
	};
	Modal.prototype.confirm = function(options){
		let title = options.title || "提示信息";
		let content = options.content || "";
		$("#error-modal .error-title").text(title);
		$("#error-modal .error-text").text(content);
		$("#error-modal").fadeIn();
		
		console.log(options.onOk);
		this.onCancel = options.onCancel || this.close;
		this.onOk = options.onOk || this.close;
	};
	Modal.prototype.close = function(){
		$("#error-modal").fadeOut();
	};
	module.exports = Modal;
})(window, $);


